#ifndef _REFORMAT_H
#define _REFORMAT_H

#define DBG_FMT		1

#ifdef DBG_FMT
#define DBG_FMT0(str);				printf("reformat(): "); printf(str);
#define DBG_FMT1(str,arg1);			printf("reformat(): "); printf(str,arg1);
#define DBG_FMT2(str,arg1,arg2);	printf("reformat(): "); printf(str,arg1,arg2);
#define DBG_FMT_PU8(str,arg);		printf("reformat(): "); printf(str); pU8(arg); printf("\n\n");
#define DBG_FMT_PS8(str,arg);		printf("reformat(): "); printf(str); pS8(arg); printf("\n\n");		
#else
#define DBG_FMT0(str);
#define DBG_FMT1(str,arg1);
#define DBG_FMT2(str,arg1,arg2); 
#define DBG_FMT_PU8(str,arg);
#define DBG_FMT_PS8(str,arg);
#endif	

/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ public prototypes                                                 + 
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
U1 reformat();

/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ private prototypes                                                + 
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/

void badIntReg(U1 arg, U8 currentbyte);		
void badFltReg(U1 arg, U8 currentbyte);
void badDblReg(U1 arg, U8 currentbyte);	

/* use when have raw bytes instead of U8 ( would use badAddress )*/

void checkAddress(U1 *arr, U8 cb); 

/* make sure don't have incomplete instruction*/

void checkCurrentByte(U8 cb, U8 end);

/* end of an instruction is allowed to be at end of bytecode*/

void checkEndCurrentByte(U8 cb, U8 end);

/* following three are used only at runtime */

void badAddress(U8 arg, U8 currentbyte);
void badStack(U8 arg, U8 currentbyte);	
void badHeap(U8 arg, U8 currentbyte);	

#endif
